﻿@model IEnumerable<Model.CostClass>


@{
    ViewBag.Title = "M_CostClass";
}
<div class="well well-sm">费用项目管理:&nbsp;<button type="button" class="btn btn-danger btn-sm" onclick="Opn_myModal_AddCostClass()">增加费用项目</button></div>
<div class="table-responsive">
    <table class="table table-hover table-condensed">
        @{


            foreach (var C in Model)
            {
                <tr>

                    <td>@C.CostClassName</td>
                    <td><button class="btn btn-default btn-sm" type="submit" onclick="Modify_CostClass('@C.CostClassID','@C.CostClassName')">修改</button></td>
                    <td><button class="btn btn-default btn-sm" type="submit" onclick="Delete_CostClass('@C.CostClassID')">删除</button></td>
                </tr>
            }}
    </table>
</div>
@Html.Partial("Modal_AddCostClass")
@Html.Partial("Modal_ModifyCostClass")
<script type="text/javascript">

    function Opn_myModal_AddCostClass() {
        $('#myModal_AddCostClass').modal('show')
    }
    function Modify_CostClass(CostClassID, CostClassName) {
        //Modify_CostClassID
        $("#myModal_ModifyCostClass .modal-header span:last-child").html(CostClassName);
        $("#myModal_ModifyCostClass .modal-header input").val(CostClassID);
        $("#myModal_ModifyCostClass").modal("show");
    }
    function Delete_CostClass(CostClassID) {
        $.ajax({
            type: 'POST',
            data: "CostClassID=" +CostClassID,
           

            url: 'Admin/Btn_DeleteCostClass',
            success: function (data) {

                if (data == "ok") {
                    //$("#myModal_AddGords").modal("hide");
                    //刷新下拉菜单绑定的商品分类

                    //增加添加成功信息
                    
                    //刷新下拉菜单绑定的商品分类
                    $("#Pannel_ManageList").load("Admin/M_CostClass");



                }
                else { alert("没有成功"); }

            },
            error: function (error) {
                alert(error.responseText);
            }
        });
    }
</script>
